import request from '../utils/request'

export default {
  // 获取商品数据列表
  getGoodsList (currentPage, pageSize, query) {
    return request({
      url: `/goods/list/search/${currentPage}/${pageSize}`,
      method: 'post',
      data: query
    })
  },
  // 新增商品数据
  addGoods (formName) {
    return request({
      url: '/goods',
      method: 'post',
      data: formName
    })
  },
  // 获取商品数据
  getById (id) {
    return request({
      url: `/goods/${id}`,
      method: 'get'
    })
  },
  // 提交修改后的商品
  update (formName) {
    return request({
      url: `/goods/${formName.id}`,
      method: 'put',
      data: formName
    })
  },
  // 删除
  deleteById (rowId) {
    return request({
      url: `/goods/${rowId}`,
      method: 'delete'
    })
  }
}
